<?php $this->view('common/include-header', array('header' => $header));?>

<div class="box-title"><i class="fa fa-home"></i>内容系统 <i class="fa fa-angle-double-right"></i>主题管理</div>
<div class="box-content">
    <div class="search bb flyer-form">
        <div class="label">
            <span class="title">主题编号 <i class="fa fa-angle-double-right"></i></span>
            <input class="key small" name="tid" type="text" value="<?=$tid?>">
        </div>
        <div class="label">
            <span class="title-cue auto">屏蔽 <i class="fa fa-angle-double-right"></i></span>
            <select class="key" name="shield">
                <option value="-1">全部</option>
                <option value="1">已屏蔽</option>
                <option value="0">未屏蔽</option>
            </select>
        </div>
        <div class="label">
            <span class="title-cue auto">添加时间 <i class="fa fa-angle-double-right"></i></span>
            <input class="key date" readonly name="start" type="text" value="">
            <span> <i class="fa fa-angle-right fa-fw"></i> </span>
            <input class="key date" readonly name="end" type="text" value="">
        </div>
        <div class="label">
            <span class="title">&nbsp;</span>
            <button class="btn normal auto" id="search-data"></button>
        </div>
        <div class="clear"></div>
    </div>
    <div class="flyer-table fat mt">
        <table id="info-table" cellspacing="0" cellpadding="0">
            <thead>
                <tr>
                    <th class="first w-300px"><i class="fa fa-th-list"></i>标题</th>
                    <th><i class="fa fa-thumbs-up"></i>支持人数</th>
                    <th><i class="fa fa-thumbs-down"></i>反对人数</th>
                    <th><i class="fa fa-user"></i>发帖人</th>
                    <th><i class="fa fa-bell-slash"></i>是否屏蔽</th>
                    <th><i class="fa fa-refresh"></i>更新时间</th>
                    <th><i class="fa fa-clock-o"></i>添加时间</th>
                    <th><i class="fa fa-gear"></i>操作</th>
                </tr>
            </thead>
            <tbody class="flyer-form">
                <tr><td colspan="8"><i class="fa fa-spinner fa-spin"></i>努力为您加载数据中 ...</td></tr>
            </tbody>
        </table>
    </div>
    <div class="page mt right" id="info-page">
        <ul class="handle">
            <li class="prev select-all" data-table="#info-table"><a><i class="fa fa-check-square"></i>全选</a></li>
            <li class="reverse-all" data-table="#info-table"><a><i class="fa fa-minus-square"></i>反选</a></li>
            <li class="next delete-mult" data-table="#info-table" data-href="<?=back_url()?>forum/delete_reply?submit_type=json"><a><i class="fa fa-trash"></i>删除选中</a></li>
        </ul>
        <div class="html"></div>
    </div>
</div>

<script src="<?=static_url()?>js/table-template.js"></script>
<script src="<?=static_url()?>js/table-init.js"></script>
<script src="<?=static_url()?>pikaday/pikaday.min.js"></script>
<link href="<?=static_url()?>pikaday/pikaday.css" rel="stylesheet">
<script>
    $(document).ready(function() {
        // 初始 日期选择框
        $.each($('.search .date'), function() {
            var pikaday = new Pikaday({
                field: $(this)[0],
            });
        });
        var json_url = '<?=back_url()?>forum/list_reply?submit_type=json';
        var table_param = {url: json_url, table: '#info-table', page: '#info-page', tpl: 'info-template', btn: '#search-data', after_function:  function(param) {
                // 初始化 表格相关事件
                table_init(param.table_body);
                // 初始化 删除按钮事件
                delete_single('#info-table tbody .delete-data', $('.delete-mult:first').data('href'));
                // 初始化 保存按钮点击事件
                save_table_click({btn: '#info-table input[name=shield]', url: '<?=back_url()?>forum/update_reply?submit_type=json'});
            }
        };
        // 搜索按钮 ajax 加载信息
        init_search_data(json_url, '#search-data', '.search .key', table_param, true);
        // 全选按钮事件
        select_all('.select-all');
        // 反选按钮事件
        reverse_all('.reverse-all');
        // 删除选中按钮事件
        delete_mult('.delete-mult');
    });
</script>
<script id="info-template" type="text/html">
    {{if infos != undefined && infos.length}}
        {{each infos as info key}}
            <tr id="tr-{{info.id}}" data-id="{{info.id}}">
                <td class="first">
                    <input class="list" type="checkbox" name="info[]" value="{{info.id}}">
                    <a class="cl-blue w-300px word-break hide-text" href="<?=back_url()?>forum/reply_detail/{{info.id}}"><font class="flyer-status blue">{{info.id}}</font> {{info.sReplyTitle}}</a>
                </td>
                <td class="category">{{info.iSupport | fmoney}}</td>
                <td>{{info.iOppose | fmoney}}</td>
                <td>{{info.iUserId}}</td>
                <td>
                    <div class="radio-one">
                        <input class="edit" id="shield-{{info.id}}" name="shield" type="checkbox"{{if info.iIsShield == 1}} checked{{/if}} value="1">
                        <label for="shield-{{info.id}}"></label>
                    </div>
                </td>
                <td>{{info.updated_at | dateShow: 'minute'}}</td>
                <td>{{info.created_at | dateShow: 'minute'}}</td>
                <td>
                    <!--a class="save-data cl-blue" href="javascript:;"><i class="fa fa-save"></i>保存</a-->
                    <a class="delete-data cl-blue" href="javascript:;"><i class="fa fa-trash-o"></i>删除</a>
                </td>
            </tr>
        {{/each}}
    {{else}}
        <tr>
            <td class="first" colspan="8">搜索程序未为您搜索到任何信息！</td>
        </tr>
    {{/if}}
</script>

<?php $this->view('common/include-footer');?>